public class PolymorphismExample {
    public static void main(String[] args) {
        AnimalBehavior dog = new Dog();
        AnimalBehavior cat = new Cat();
        dog.makeSound();
        cat.makeSound();
        playWithAnimal(dog);
        playWithAnimal(cat);
    }
    public static void playWithAnimal(AnimalBehavior animal) {
        System.out.println("Playing with a"
                + animal.getClass().getSimpleName().toLowerCase()+"that says");
        animal.makeSound();
    }
}
